package com.ys.gulimall.config;

import com.ys.gulimall.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description:
 * @author： yeswater
 * @create： 2024/5/17
 */

@Configuration
public class GulimallWebConfig implements WebMvcConfigurer {
	
	/**
	 * 添加拦截器的配置，不能只把拦截器加入容器中，不然拦截器不生效的
	 */
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
	}
}
